Add GitHub Actions testing workflow#35
Conversation
AGE-135 Tiger CLI: Add test/lint workflow to GitHub Actions
Run |
| - name: Install keyring dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y gnome-keyring dbus-x11 | ||
|
|
||
| - name: Start D-Bus and keyring | ||
| run: | | ||
| # Start D-Bus session | ||
| eval $(dbus-launch --sh-syntax) | ||
| echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> $GITHUB_ENV | ||
|
|
||
| # Initialize gnome-keyring with a test password | ||
| echo 'test' | gnome-keyring-daemon --unlock | ||
| eval $(echo 'test' | gnome-keyring-daemon --start --components=secrets) | ||
| echo "GNOME_KEYRING_CONTROL=$GNOME_KEYRING_CONTROL" >> $GITHUB_ENV |
There was a problem hiding this comment.
This was necessary to get the tests that rely on the keyring to pass in CI. Tbh, Claude wrote this code and I didn't take time to understand it, but it did make the tests pass 😅. It's definitely possible that some of this is wonky or unnecessary.
| # Format checksum for validation: "hash filename" | ||
| local formatted_checksum | ||
| formatted_checksum=$(printf "%s %s\n" "$(cat "${checksum_file}" | tr -d '[:space:]')" "${filename}") | ||
| formatted_checksum=$(printf "%s %s\n" "$(tr -d '[:space:]' < "${checksum_file}")" "${filename}") |
There was a problem hiding this comment.
Addresses https://www.shellcheck.net/wiki/SC2002, which was only showing up in CI because the GitHub Actions ubuntu image includes an older version of shellcheck, and the shellcheck docs say:
This suggestion was enabled by default up to and including ShellCheck 0.10.0.
In later versions, it is optional. It must be explicitly enabled with a directive enable=useless-use-of-cat in a # shellcheck comment or .shellcheckrc
Adds a GitHub Actions workflow for building and testing the code. Also runs
shellcheckon theinstall.shscript.I also:
-raceflag, which seemed to be caused byviper.WatchConfig()(possibly Data race in WatchConfig() / ReadInConfig() spf13/viper#174). Rather than relying onviper.WatchConfig()to reload the config file into viper's internal state when it changes, we now manually reload it wheneverconfig.Load()is called. This ensures that MCP server tool calls (which always reload the config withconfig.Load()) will always be using the most up-to-date config state, which was the original purpose of addingviper.WatchConfig()in Fix issues with config file/directory logic #20.shellcheckissue in theinstall.shscript that was only failing in CI, because the GitHub Actions ubuntu image users an older version of shellcheck by default (see https://www.shellcheck.net/wiki/SC2002).Closes AGE-135